const state = {
    folderList: {},
    folderId: null,
    apiObject: null,
    type: null,
    showSaveFolder: false,
};
const getters = {};
const mutations = {};
const actions = {
    setFolderId(context, folderId) {
        context.state.folderId = folderId;
    },
    changeFolderStatus(context, showSaveFolder) {
        context.state.showSaveFolder = showSaveFolder;
    },
    setFolderObject(context, obj) {
        context.state.folderList = obj.folderList;
        context.state.apiObject = obj.apiObject;
        context.state.type = obj.type;
    },
    saveFolderObject(context) {
        if (context.state.folderId) {
            context.state.apiObject[context.state.type](context.state.folderId);
        };
    },
    clearFolderObject(context) {
        context.state.folderId = null;
        context.state.showSaveFolder = false;
        context.state.folderList = null;
        context.state.apiObject = null;
        context.state.type = null;
    },
};

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
}